document.onreadystatechange = function()
{    
    if(document.readyState=="complete")
    {
        var wsUrl = System.Gadget.Settings.read("webServiceUrl");
        if(wsUrl != "")
        {
            urlBox.value = wsUrl;
        }       
    }        
}

System.Gadget.onSettingsClosing = function(event)
{
    if (event.closeAction == event.Action.commit) 
    {
        var wsUrl = urlBox.value;
        if(wsUrl != "")
        {
            System.Gadget.Settings.write("webServiceUrl", wsUrl);
        }
        event.cancel = false;
    }
}

